#include<iostream>
#include<vector>

using namespace std;

int main(){
	int i,j;
	int a,b,c=10000;
	vector<int> h(c,0);
	while(scanf("%d%d%d",&a,&b,&c)!=EOF){
		for(i=a;i<=c;i++){
			h[i]=max(h[i],b);
		}
	}
	int end=c;
	for(i=0;i<=end;i++){
		if(i==0&&h[0]!=0){
			cout<<0<<' '<<h[0]<<' ';
		}else if(i==0){
			continue;
		}else if(h[i-1]<h[i]){
			cout<<i<<' '<<h[i]<<' ';
		}else if(h[i-1]>h[i]&&i!=end){
			cout<<i-1<<' '<<h[i]<<' ';
		}else if(i==end){
			cout<<end<<' '<<0<<endl;
		}else {
			continue;
		}
	}
	return 0;
}
